layui.define(['table','layer', 'form', 'admin', 'ax','upload','formSelects'], function (exports) {
    var $ = layui.$;
    var $ax = layui.ax;
    var form = layui.form;
    var admin = layui.admin;
    var layer = layui.layer;
    var upload=layui.upload;
    var formSelects=layui.formSelects;
    var table = layui.table;


    /**
     * 检索店名--门店装修这里只有半天妖
     */
    // var languageAjax = new $ax(Feng.ctxPath + "/btyBxda/getDm");
    // var languageResult = languageAjax.start();
    // $.each(languageResult, function( index, val ) {
    //     $("#dm").append("<option value='"+val.dm+"'>"+val.dm+"</option>");
    // } );
    // //form.render('select');
    // formSelects.render('dm');

     function bankCode() {
        var yhk=$("#yhk").val();
        var bankAjax = new $ax(Feng.ctxPath + "/btyBxda/bankCode?bankNo="+yhk+"");
        var bankCode=bankAjax.start();
        if(bankCode==""){
            $("#bz").val("")
            alert("识别错误！");

        }else{
            $("#bz").val(bankCode);
        }


    };
    // 导出excel
    $('#btnExp').click(function () {
        bankCode();
    });
    // 表单提交事件
    form.on('submit(btnnnSubmit)', function (data) {
        var ajax = new $ax(Feng.ctxPath + "/btyBxda/add", function (data) {
            if(data.code==200){
                Feng.success("添加成功！");
                //传给上个页面，刷新table用
                //admin.putTempData('formOk', true);
                layui.shuxinBaoXiaoRen(data.data.yhk);
            }
            //关掉对话框
            admin.closeThisDialog();

        }, function (data) {
            Feng.error("添加失败！" + data.responseJSON.message)
        });
        ajax.set(data.field);
        ajax.start();

        //添加 return false 可成功跳转页面
        return false;
    });
});
